package com.zhongyouyun.admin.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongyouyun.admin.model.*;
import com.zhongyouyun.admin.pojo.LogPojo;
import com.zhongyouyun.admin.service.MenuService;
import com.zhongyouyun.admin.service.RoleMenuService;
import com.zhongyouyun.other.annotation.DataAuthScope;
import com.zhongyouyun.other.annotation.SysLogAnnotation;
import com.zhongyouyun.other.model.PageRequest;
import com.zhongyouyun.utils.QueryUtils;
import io.swagger.annotations.*;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zhongyouyun.admin.service.LogService;

import java.util.List;


/**
 * @Author: shenyi
 * @Date: 2022-04-24
 * @Description:
 */
@RestController
@RequestMapping("/admin/z_log")
@Api(value = "日志controller", tags = {"日志接口"})
public class LogController {
    @Autowired
    private LogService service;
    @Autowired
    private RoleMenuService roleMenuService;
    @Autowired
    private MenuService menuService;

    @PostMapping("/findPage")
    @ResponseBody
    @ApiOperation(value = "操作日志管理列表", notes = "通过条件查询操作日志列表")
    @SysLogAnnotation(operModul = "系统管理>>日志管理", operType = "日志列表", operDesc = "日志列表")
    @DataAuthScope(deptAlias = "temp_data_scope.")
    public IPage<LogPojo> findPage(@RequestBody PageRequest pageRequest) {
        QueryWrapper<LogPojo> queryWrapper = new QueryWrapper();
        QueryUtils.fiterQuery(queryWrapper, pageRequest);
        Page page = new Page(pageRequest.getPageNum(), pageRequest.getPageSize());
        return service.selectPojoPage(page, queryWrapper);
    }
}
